import { createApp, createVNode } from 'vue'
import ElementPlus from 'element-plus'
import App from './App.vue'
import router from './router'
import permission from '@/router/permission'
import { store, key } from './store'
import '@/styles/index.scss'
// If you want to use ElMessage, import it.
import 'element-plus/theme-chalk/src/message.scss'
//引入图标
import * as Icons from '@element-plus/icons-vue'

const app = createApp(App)
app.use(store, key)
app.use(ElementPlus, { size: 'large', zIndex: 3000 })

app.use(router)
app.use(permission)
app.mount('#app')
const Icon = (props: { icon: string }) => {
  const { icon } = props
  return createVNode(Icons[icon as keyof typeof Icons])
}
app.component('Icon', Icon)
